<%@ Page Title="Member_Recharge List" Language="C#" AutoEventWireup="true" CodeBehind="Member_RechargeList.aspx.cs" Inherits="Youz.CreditRepay.Manage.Member_RechargeList" %>

<script>
    //loadCSS("assets/plugins/gritter/css/jquery.gritter.css");

    var requireJS = [
        //"assets/plugins/gritter/js/jquery.gritter.min.js"
    ];

    loadJS(requireJS);
    $(function () {
        $('.form_date').datetimepicker({
            language: "zh_CN",
            format: "yyyy-mm-dd",
            autoclose: true,
            todayBtn: true,
            todayHighlight: true,
            pickerPosition: "bottom-left",
            startView: 2,
            minView: 2,
            forceParse: 0
        });
    });
</script>
<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-heading" data-original-title>
                <h2><i class="fa fa-align-justify"></i><span style="font-size: 16px; padding-right: 15px;"><%: R(LanguageModule.Member_Recharge, "Member_Recharge", "Member_Recharge") %></span></h2>
                <div class="panel-actions"></div>
            </div>
            <div class="panel-body">
                <div class="alert alert-danger" style="display: none;">
                    <button type="button" class="close" data-dismiss="alert">×</button><strong><i class="fa fa-warning"></i></strong><span class="content"></span>
                </div>
                <form class="form-horizontal">
                    <div class="row">
                        <div class="col-md-3">
                            <div class="form-group">
                                <label class="col-md-3 control-label"><%: R(LanguageModule.M_Common, "MemberAccount", "会员帐号") %></label>
                                <div class="col-md-9">
                                    <input type="email" id="MemberAccount" maxlength="100" name="MemberAccount" class="form-control" placeholder="<%: R(LanguageModule.M_Common, "MemberAccount", "会员帐号") %>">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="RoleDesc"><%: R(LanguageModule.M_Common, "Status", "状态") %></label>
                                <div class="col-md-9">
                                    <select name="Status" id="Status" class="form-control">
                                        <option value=""><%: R(LanguageModule.M_Common, "All", "全部") %></option>
                                        <option value="0"><%: R(LanguageModule.Member_Recharge, "Pending", "待汇款") %></option>
                                        <option value="1"><%: R(LanguageModule.Member_Recharge, "Untreated", "未处理") %></option>
                                        <option value="2"><%: R(LanguageModule.Member_Recharge, "Processing", "处理中") %></option>
                                        <option value="3"><%: R(LanguageModule.Member_Recharge, "Ratify", "批准申请") %></option>
                                        <option value="4"><%: R(LanguageModule.Member_Recharge, "Refuse", "拒绝申请") %></option>
                                        <option value="5"><%: R(LanguageModule.Member_Recharge, "Revoked", "已撤消") %></option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="form-group">
                                <label class="col-md-3 control-label"><%: R(LanguageModule.Member_Info, "CreateTime", "创建时间") %></label>
                                <div class="col-md-9">
                                    <div class="input-group">
                                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                        <input type="text" data-date-format="yyyy/mm/dd" id="StartDate" class="form-control form_date" />
                                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                        <input type="text" data-date-format="yyyy/mm/dd" id="EndDate" class="form-control form_date" />
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-2">
                            <button type="button" id="btnQuery" name="btnQuery" class="btn btn-default btn-ar btn-primary">
                                <i class="fa fa-search "></i>
                                <%: R(LanguageModule.M_Common, "Query") %>
                            </button>
                        </div>
                    </div>
                </form>
                <table id="table" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%"></table>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    var dt;

    $(function () {

        dt = $('#table').DataTable({
            "ajax": {
                "url": 'Member/Handlers/Member_RechargeHandler.ashx?type=list',
                "type": "POST",
                "dataSrc": "data",
                "data": function (d) {
                    d.MemberAccount = $('#MemberAccount').val();
                    d.Status = $('#Status').val();
                    d.StartDate = $('#StartDate').val();
                    d.EndDate = $('#EndDate').val();
                }
            },
            "columns": [
                    { "data": 'RowIndex', "title": "#" },
                    {
                        data: "RechargeID",
                        title: '操作',
                        width: 60,
                        render: function (data, type, row) {
                            if (row.Status == 1 || row.Status == 2) {
                                return "<a href='javascript:;' class='btn btn-info btn-xs' title='审核' onclick='Audit(\"" + row.RechargeID + "\")'><i class='fa fa-pencil'> 审核</i></a>";
                            }
                            else {
                                return "<a href='javascript:;' class='btn btn-default btn-xs active' title='查看' onclick='View(\"" + row.RechargeID + "\")'><i class='fa fa-eye'> 查看</i></a>";
                            }
                        },
                        className: "dt-body-center"
                    },
                    { "data": 'RechargeID', "title": "<%: R(LanguageModule.Member_Recharge, "RechargeID", "验证单号") %>" },
                    { "data": 'MemberAccount', "title": "<%: R(LanguageModule.M_Common, "MemberAccount", "会员帐号") %>" },
                    { "data": 'Status', "title": "<%: R(LanguageModule.Member_Recharge, "Status", "状态") %>", render: RStatus },
                    {
                        data: "",
                        title: '您的银行账户',
                        render: function (data, type, row, meta) {
                            return row['FromBankAccountName'] + "/" + row['FromBankName'] + "/" + row['FromBankAccountNo']
                        }
                    },
                     {
                         data: "",
                         title: '公司银行账户',
                         render: function (data, type, row, meta) {
                             return row['ToBankAccountName'] + "/" + row['ToBankName'] + "/" + row['ToBankAccountNo']
                         }
                     },
                    <%--{ "data": 'FromBankName', "title": "<%: R(LanguageModule.Member_Recharge, "FromBankName", "转账银行名称") %>" },
                    { "data": 'FromBankAccountNo', "title": "<%: R(LanguageModule.Member_Recharge, "FromBankAccountNo", "转账银行账户号") %>" },
                    { "data": 'FromBankAccountName', "title": "<%: R(LanguageModule.Member_Recharge, "FromBankAccountName", "转账银行賬戶名") %>" },
                    { "data": 'ToBankName', "title": "<%: R(LanguageModule.Member_Recharge, "ToBankName", "收款银行名称") %>" },
                    { "data": 'ToBankAccountNo', "title": "<%: R(LanguageModule.Member_Recharge, "ToBankAccountNo", "收款银行账户号") %>" },
                    { "data": 'ToBankAccountName', "title": "<%: R(LanguageModule.Member_Recharge, "ToBankAccountName", "收款银行賬戶名") %>" },--%>
                    { "data": 'CurrencyName', "title": "<%: R(LanguageModule.Member_Recharge, "MoneyType", "币种") %>" },
                    { "data": 'FromAmount', "title": "<%: R(LanguageModule.Member_Recharge, "FromAmount", "充值金额") %>", render: fmoney },
                    { "data": 'ToAmount', "title": "<%: R(LanguageModule.Member_Recharge, "ToAmount", "实际金额") %>", render: fmoney },
                    { "data": 'TransferTime', "title": "<%: R(LanguageModule.Member_Recharge, "TransferTime", "转账日期") %>" },
                    { "data": 'Accessory', "title": "<%: R(LanguageModule.Member_Recharge, "Accessory", "附件（汇款凭证）") %>" },
                    { "data": 'Memo', "title": "<%: R(LanguageModule.Member_Recharge, "Memo", "备注") %>" },
                    { "data": 'CreateTime', "title": "<%: R(LanguageModule.Member_Recharge, "CreateTime", "创建时间") %>" },
                    { "data": 'ModifyTime', "title": "<%: R(LanguageModule.Member_Recharge, "ModifyTime", "修改时间") %>" },

            ]
        });

        $('#btnQuery').click(function () {
            if (validateStartDateEndDate($('#StartDate').val(), $('#EndDate').val())) {
                dt.ajax.reload();
            }
        });


    });

    //充值状态
    function RStatus(value) {
        switch (value) {
            case 0:
                return '<span class="label label-default"><%: R(LanguageModule.Member_Recharge, "Pending", "待汇款") %></span>';
                break;
            case 1:
                return '<span class="label label-info"><%: R(LanguageModule.Member_Recharge, "Untreated", "未处理") %></span>';
                break;
            case 2:
                return '<span class="label label-danger"><%: R(LanguageModule.Member_Recharge, "Processing", "处理中") %></span>';
                break;
            case 3:
                return '<span class="label label-primary"><%: R(LanguageModule.Member_Recharge, "Ratify", "批准申请") %></span>';
                break;
            case 4:
                return '<span class="label label-success"><%: R(LanguageModule.Member_Recharge, "Refuse", "拒绝申请") %></span>';
                break;
            case 5:
                return '<span class="label label-warning"><%: R(LanguageModule.Member_Recharge, "Revoked", "已撤消") %></span>';
                break;
        }
    }


    //审核
    function Audit(RechargeID) {
        if (RechargeID.length > 0) {
            loadPage("Member/Member_RechargeItem.aspx?RechargeID=" + RechargeID);
        }
    }
    //查看
    function View(RechargeID) {
        if (RechargeID.length > 0) {
            loadPage("Member/Member_RechargeItem.aspx?RechargeID=" + RechargeID + "&View=1");
        }
    }
</script>
